$(document).ready(function () {
    var chartName = getQueryVariable("chartName");
    refreshRankList(chartName);
    window.setInterval(function () {
        refreshRankList(chartName);
    },20000);
    console.log("客户端定时刷新");//轮询

});
function refreshRankList(chartName) {
    $.ajax({
        "url": "chartController/charts/" + chartName,
        "type": "get",
        "dataType": "json",
        "success": function (dto) {
            console.log(dto);
            if (dto.code == 200) {
                $('#rankList').html(JSON.stringify(dto.tList));
                var chartItems = new Array();
                var charts = dto.tList;//从ajax取得数据
                $(charts).each(function (i,chart) {//循环数据 将数组重新组成一个对象数组
                    var data = new Array();
                    data.push(chart.value)
                    var chartItem  = new ChartBarItem(chart.name,data,chart.name+"  "+ chart.comment);
                    chartItems.push(chartItem);
                });

                showBar(chartItems);//将对象数组（数据集）提供给highchar使用
            } else {
                alert(dto.msg);
            }
        }
    });
}
